﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using SARUserControls;
using System.IO;

namespace SAR
{
    public partial class TestPage6
    {
        public TestPage6()
        {
            this.InitializeComponent();

            // 在此点之下插入创建对象所需的代码。
        }

        private void sAR_BigButton1_SARBigBtnClick(object sender, MouseButtonEventArgs e)
        {
            objectMenu1.SARRealheight *= 2;
            objectMenu1.SARRealwidth *= 2;
        }

        private void sAR_BigButton2_SARBigBtnClick(object sender, MouseButtonEventArgs e)
        {
            List<ObjectInstance> all = objectMenu1.SARAllInsctances;
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("Real Width:{0},Real Height:{1}\r\n", this.objectMenu1.SARRealwidth, this.objectMenu1.SARRealheight);
            foreach (ObjectInstance ins in all)
            {
                sb.AppendFormat("ObjectName:{0},X:{1},Y:{2},Values[", ins.SARObjectName, ins.SARPostion.X,ins.SARPostion.Y);
                foreach (string key in ins.SARAttrValues.Keys)
                {
                    sb.AppendFormat("{0}={1};", key, ins.SARAttrValues[key]);
                }
                sb.Append("]\r\n");
            }

            File.WriteAllText("d:\\123.txt",sb.ToString());
            MessageBox.Show("结果保存到d:\\123.txt了");
        }
    }
}